﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    /// <summary>
    /// 商品明细表实体类
    /// </summary>
    public class Product
    {
        public string ProductID { get; set; }     //商品编号
        public string ProductName { get; set; }   //商品名称
        public string SpellingCode { get; set; }  //拼音码
        public string BarCode { get; set; }       //条形码 
        public string Special { get; set; }       //商品规格
        public string Unit { get; set; }          //计量单位
        public string Origin { get; set; }        //产地
        public decimal PurchasePrice { get; set; }// 购进成本
        public decimal SalePrice { get; set; }    //销售成本
        public int Quantity { get; set; }         //商品数量
        public virtual Category Category { get; set; }    //商品类别
        public Product()
        {
            this.PurchasePrice = this.SalePrice = 0.00M;
            this.Quantity = 0;
        }
        public Product(Product p,Category c=null) 
        {
            this.ProductID = p.ProductID;
            this.ProductName = p.ProductName;
            this.SpellingCode = p.SpellingCode;
            this.BarCode = p.BarCode;
            this.Special = p.Special;
            this.Unit = p.Unit;
            this.Origin = p.Origin;
            this.PurchasePrice = p.PurchasePrice;
            this.SalePrice = p.SalePrice;
            this.Quantity = p.Quantity;
            if (c != null)
            {
                this.Category = new Category();
                this.Category.CategoryID = c.CategoryID;
                this.Category.CategoryName = c.CategoryName;
            }
        }                                               
    }
}
